import React from 'react'
import { Users } from './searchPannel'

interface project {
	id: number
	name: string
	personId: number
	organization: string
	created: number
}

interface ListProps {
	list: project[]
	users: Users[]
}

export const List = ({ list, users }: ListProps) => {
	return (
		<>
			<table>
				<thead>
					<tr>
						<th>名称</th>
						<th>负责人</th>
					</tr>
				</thead>
				<tbody>
					{list?.map((project) => (
						<tr key={project.id}>
							<td>{project?.name}</td>
							<td>
								{users.find((user) => user.id === project.id)?.name || '未知'}
							</td>
						</tr>
					))}
				</tbody>
			</table>
		</>
	)
}
